﻿using FluentValidation;
using SH.Common.DataDictionary;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SH.Multitenant.Domain.RBAC
{
    public class Role : Tenant
    {
        /// <summary>
        /// 角色编号
        /// </summary>
        [SugarColumn(IsIdentity = true, IsPrimaryKey = true)]

        public int RoleId { get; set; }
        /// <summary>
        /// 角色名称
        /// </summary>
        [SugarColumn(ColumnDataType = "Nvarchar(20)")]
        public string? RoleName { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }
    }

    public class RoleValidator : AbstractValidator<Role>
    {
        public RoleValidator()
        {
            RuleFor(x => x.RoleName).NotEmpty().MaximumLength(20);
            RuleFor(x => x.CreateTime).NotEmpty();
        }
    }
}
